【教程】ubuntu中配置tftp | 您所在的位置:网站首页 › Ubuntu 安装tftp网络 › 【教程】ubuntu中配置tftp |
Preface 今天在 Ubuntu 12.04LTS下配置 tftp时走了些弯路,囧,记录下 下面的方案怎么也工作不起来 1.安装tftpd(tftp服务器)、tftp(tftp客户端)以及xinetd(超级服务器) 1 #sudo apt-get install tftpd tftp xinetd2.建立配置文件,创建/etc/xinetd.d/tftp文件,并在文件中添加如下内容 1 2 3 4 5 6 7 8 9 10 11 12 13 14 mystery@lcw: /etc/xinetd .d$ sudo vim tftp 1 service tftp 2 { 3 disable = no 4 socket_type = dgram 5 protocol = udp 6 wait = yes 7 user = mystery 8 server = /usr/sbin/in .tftp 9 server_args = -s /home/mystery/tftp 10 source = 11 11 cps = 100 2 12 flags = IPv4 13 }3.建立配置文件,创建/etc/xinetd.d/tftp文件,并更改权限 1 2 3 4 mystery@lcw:~$ sudo mkdir /home/mystery/tftp mystery@lcw:~$ sudo chmod -R 777 /home/mystery/tftp mystery@lcw:~$ sudo chown -R mystery /home/mystery/tftp mystery@lcw:~$4. 通过xinetd超级服务器启动tftpd 在这之前,先重启下进程 1 mystery@lcw: /etc $ sudo reload xinetd然后重启服务 1 2 3 4 mystery@lcw: /etc/default $ sudo service xinetd restart xinetd stop /waiting xinetd start /running , process 3350 mystery@lcw: /etc/default $5. 测试 1 2 3 4 5 6 tftp> status Connected to 192.168.123.24. Mode: netascii Verbose: off Tracing: off Rexmt-interval: 5 seconds, Max-timeout: 25 seconds tftp> get test Transfer timed out.出现 Transfer timed out 然后就是怎么测试都不成功! 正确的配置方法 1、安装:tftp-hpa,tftpd-hpa,xinetd 1 mystery@lcw: sudo apt-get install tftp-hpa tftpd-hpa xinetd2、配置/etc/default/tftpd-hpa 1 2 3 4 5 6 1 # /etc/default/tftpd-hpa 2 3 TFTP_USERNAME= "tftp" 4 TFTP_DIRECTORY= "/home/mystery/tftp" 5 TFTP_ADDRESS= "0.0.0.0:69" 6 TFTP_OPTIONS= "--secure -c"说明:第二项改成你自己定义的tftp工作目录路径;第四项添加一个“-s”参数以便运行执行put操作(--secure等同于-s; -c等同与--create) 3、设置工作目录/home/mystery/tftp权限 1 2 3 mystery@lcw:~$ sudo chmod -R 777 /home/mystery/tftp mystery@lcw:~$ sudo chown -R mystery /home/mystery/tftp mystery@lcw:~$4、重新启动服务 1 2 3 mystery@lcw:~$ sudo service tftpd-hpa restart tftpd-hpa stop /waiting tftpd-hpa start /running , process 55405、通过tftp的get和put进行测试 1 2 3 4 5 6 7 mystery@lcw:~$ tftp localhost tftp> get test tftp> put minicom.log tftp> q mystery@lcw:~$ ls /home/mystery/tftp/ minicom.log test mystery@lcw:~$OK,TFTP又开始正常工作,囧…… 本文转自infohacker 51CTO博客,原文链接:http://blog.51cto.com/liucw/1223695 |
CopyRight 2018-2019 实验室设备网 版权所有 |